/**
 * 
 */
package br.com.sistema.hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * @author alex
 *
 */
public class HibernateUtil {
	private static final SessionFactory session = buildSessionFactory();
	
	private static final SessionFactory buildSessionFactory() {
		try {
			Configuration cfg = new Configuration();
			cfg.configure("hibernate.cfg.xml");
			return cfg.buildSessionFactory();
		} catch (Exception ex) {
			System.out.println(ex.getMessage());
			return null;
		}
	}
	public static SessionFactory getSession(){
		return HibernateUtil.session;
	}
}
